<div class="section">
    <?php
        echo $this->element('toolbar');
    ?>
    <?php
        echo $this->Form->create('Block', array('id' => 'paginate', 'action' => 'add', 'url' => $this->request->here(false), 'type' => 'post',
                'inputDefaults' => array('label' => false, 'format' => array('before', 'label', 'between', 'input', 'after', 'error'))));

        // hidden on debug = 0    
        $_layouts = array_merge(array(array(
                    'Module Config',
                    array(array('module', 'delta'),array('theme_name','style_block'),array('node_type_id','is_general')))), $_layouts);

        $modules = Configure::read('Modules');
        $modules = array_combine(array_keys($modules), Set::classicExtract($modules, '{s}.name'));
        $fieldsets['module'] = $this->Form->input('module', array(
                'label' => __d('system', 'Module'),
                'onchange' => "$('#BlockCustom').val($(this).val() != '0' ? 0 : 1)",
                'options' => array_merge(array('0' => __d('system', 'Custom')), $modules),
                'type' => 'select'));        
        $fieldsets['delta'] = $this->Form->input('delta', array(
                'label' => __d('system', 'Delta'),
                'default' => 0,
                'div' => array('class' => 'input select input-delta'),
                'type' => 'text'));   
        $listTheme = Configure::read('App.themes.listTheme'); 
        $fieldsets['theme_name'] = $this->Form->input('theme_name', array(
                'label' => __d('system', 'Themes'),
                /*'options'=>$listTheme, */                          
                'default' =>$listTheme[$theme_id],
                'type' => 'text'));
        $fieldsets['style_block'] = $this->Form->input('style_block', array(
                'label' => __d('system', 'Style Block'),
                'options'=>$listBlock, 
                'style'=>array('min-width:200px'), 
                'empty'=>__d('system','--- Chọn Style Block ---'),                      
                'type' => 'select'));   
        $fieldsets['node_type_id'] = $this->Form->input('node_type_id', array(
                'label' => __d('system', 'Choose Node Type'),
                'options'=>$listNodeTypes, 
                'style'=>array('min-width:200px'), 
                'empty'=>__d('system','--- Choose Node Type ---'),                      
                'type' => 'select')); 
        $fieldsets['is_general'] = $this->Form->input('is_general', array(
                'label' => array('text'=> 'General'),                                                           
                'type' => 'checkbox'));        
        $fieldsets['title'] = $this->Form->input('title', array(
                'label' => __d('system', 'Title'),
                'type' => 'text'));
        $fieldsets['title'] .= $this->Html->div('colcomment', __d('system', 'The title of the block as shown to the user.'));

        $fieldsets['description'] = $this->Form->input('description', array(
                'label' => __d('system', 'Description'),
                'type' => 'text'));
        $fieldsets['description'] .= $this->Html->div('colcomment', __d('system', 'A brief description of your block. Used on the Blocks administration page.'));

        $fieldsets['content'] = $this->Form->input('content', array(
                'label' => __d('system', 'Content'),
                'type' => 'textarea'));
        $fieldsets['content'] .= $this->Html->div('colcomment', __d('system', 'The content of the block as shown to the user.'));
        $fieldsets['include'] = $this->Form->input('include', array(
                'label' => __d('system', 'Show block on specific pages'),
                'type' => 'textarea'));
        $fieldsets['include'] .= $this->Html->div('colcomment', __d('system', 'Specify pages by using their paths. Enter one path per line. The \'*\' character is a wildcard. Example paths are blog for the blog page and /blog/* for every personal blog. <front> is the front page'));
        $fieldsets['exclude'] = $this->Form->input('exclude', array(
                'label' => __d('system', 'Hide block on specific pages'),
                'type' => 'textarea'));
        $fieldsets['exclude'] .= $this->Html->div('colcomment', __d('system', 'Specify pages by using their paths. Enter one path per line. The \'*\' character is a wildcard. Example paths are blog for the blog page and /blog/* for every personal blog. <front> is the front page'));
        $fieldsets['language'] = $this->Form->input('language', array(
                'label' => __d('system', 'Show block on specific language'),
                'multiple' => 'checkbox',
                'options' => $this->Layout->listLanguages(),
                'type' => 'select'));
        $fieldsets['language'] .= $this->Html->div('colcomment', __d('system', 'If no language(s) is selected, block will show regardless of language.'));
        $fieldsets['role_id'] = $this->Form->input('Role', array(
                'label' => __d('system', 'Show block on specific roles'),
                'multiple' => 'checkbox',
                'options' => $roles,
                'type' => 'select'));
        $fieldsets['role_id'] .= $this->Html->div('colcomment', __d('system', 'Show this block only for the selected role(s). If you select no roles, the block will be visible to all users.'));
    ?>

    <div class="panel clearfix">
        <fieldset>
            <?php
                echo $this->Layout->form($_layouts, $fieldsets);
            ?>
        </fieldset>
    </div>    
    <?php
        echo $this->Form->input('custom', array('value' => 1, 'style' => 'display:none;', 'type' => 'text', 'div' => false));
        echo $this->Form->hidden('Paginate.task', array('id' => 'task', 'value' => ''));
        echo $this->Form->hidden('Block.theme_id', array('value' => $theme_id));
        echo $this->Form->end();
    ?>
</div>